<template>
  <div>
    <!-- 添加或修改公告对话框 -->
    <el-dialog title="消息详情" :visible.sync="$parent.open" width="780px" append-to-body>
      <div class="center_dialog">
        {{ rowObj.message && rowObj.message.content || '-' }}
      </div>
      <div align="center" slot="footer" class="dialog-footer">
        <el-button type="primary" @click="() => $parent.open = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { getReceiverlist, putmess } from "@/api/system/message.js";
export default {
  props: ['rowObj'],
  components: {
  },
  data () {
    return {
      // 总条数
      total: 0,
      loading: true,
      noticeList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
    }
  },
  created () {
    this.getList()
  },
  methods: {
    /** 查询列表 */
    async getList () {
      this.loading = true;
      let params = {
        ...this.queryParams,
        messageId: this.rowObj.messageId
      }
      putmess({ messageUserId: this.rowObj.messageUserId, status: '0' }).then(() => {
        this.$emit('childOpen');
      })
      // getReceiverlist(params).then(response => {
      //   this.noticeList = response.data && response.data.map((item, index) => {
      //     return {
      //       ...item,
      //       order: index + 1
      //     }
      //   });
      //   this.total = response.total;
      //   this.loading = false;
      // });
    },
    SelectChange () {
      for (let index = 0; index < this.form.userIds.length; index++) {
        const element = this.form.userIds[index];
        if (element === -1) {//包含全部用户
          this.form.userIds = [-1]
          return
        }
      }

    },
    //提交
    submitForm () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.title === '修改广告') {//修改

          } else {//新增
            let params = {
              ...this.form,
              userIds: this.form.userIds[0] === -1 ? null : this.form.userIds
            }
            PostCreatedmessage(params).then(res => {
              if (res.code === 200) {
                this.$message.success(res.msg)
                this.$parent.open = false
                this.$parent.handleUpdate()
              }
            })
          }
        }
      });
    },
  }
}
</script>

<style lang="scss" scoped>
.center_dialog {
  // text-align: center;
  width: 85%;
  margin: 0px auto;
  text-align: center;
}
</style>